package com.cloud.controller;

import com.cloud.common.result.Result;
import com.cloud.common.result.ResultCode;
import com.cloud.model.entity.Payment;
import com.cloud.model.form.PaymentForm;

import com.cloud.service.PaymentFeignService;
import lombok.RequiredArgsConstructor;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.loadbalancer.FeignBlockingLoadBalancerClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * 订单表 前端控制器
 *
 * @author Sailer Wen
 * @since 2024-07-22
 */
@RestController
@RequestMapping("/consumer")
@Slf4j
public class OrderController {


    @Resource
    private PaymentFeignService paymentFeignService;

    @GetMapping(value = "/payment/{id}")
    public Result<Payment> getPaymentById(@PathVariable("id") Long id) {
        return paymentFeignService.getPaymentById(id);
    }

    @GetMapping(value = "/payment/feign/timeout")
    public String paymentFeignTimeout() {
        // OpenFeign客户端一般默认等待1秒钟
        return paymentFeignService.paymentFeignTimeout();
    }


}
